\(\int x \cos ^2(x) \cot ^3(x) \, dx\) [207]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 10, antiderivative size = 73 \[ \int x \cos ^2(x) \cot ^3(x) \, dx=-\frac {3 x}{4}+i x^2-\frac {\cot (x)}{2}-\frac {1}{2} x \cot ^2(x)-2 x \log \left (1-e^{2 i x}\right )+i \operatorname {PolyLog}\left (2,e^{2 i x}\right )+\frac {1}{4} \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x) \]

[Out]

-3/4*x+I*x^2-1/2*cot(x)-1/2*x*cot(x)^2-2*x*ln(1-exp(2*I*x))+I*polylog(2,exp(2*I*x))+1/4*cos(x)*sin(x)+1/2*x*si
n(x)^2

Rubi [A] (verified)

Time = 0.20 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps used = 16, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.000, Rules used = {4493, 3524, 2715, 8, 3798, 2221, 2317, 2438, 3801, 3554} \[ \int x \cos ^2(x) \cot ^3(x) \, dx=i \operatorname {PolyLog}\left (2,e^{2 i x}\right )+i x^2-\frac {3 x}{4}-2 x \log \left (1-e^{2 i x}\right )+\frac {1}{2} x \sin ^2(x)-\frac {1}{2} x \cot ^2(x)-\frac {\cot (x)}{2}+\frac {1}{4} \sin (x) \cos (x) \]

[In]

Int[x*Cos[x]^2*Cot[x]^3,x]

[Out]

(-3*x)/4 + I*x^2 - Cot[x]/2 - (x*Cot[x]^2)/2 - 2*x*Log[1 - E^((2*I)*x)] + I*PolyLog[2, E^((2*I)*x)] + (Cos[x]*
Sin[x])/4 + (x*Sin[x]^2)/2

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2221

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x]
 - Dist[d*(m/(b*f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 3524

Int[Cos[(a_.) + (b_.)*(x_)^(n_.)]*(x_)^(m_.)*Sin[(a_.) + (b_.)*(x_)^(n_.)]^(p_.), x_Symbol] :> Simp[x^(m - n +
 1)*(Sin[a + b*x^n]^(p + 1)/(b*n*(p + 1))), x] - Dist[(m - n + 1)/(b*n*(p + 1)), Int[x^(m - n)*Sin[a + b*x^n]^
(p + 1), x], x] /; FreeQ[{a, b, p}, x] && LtQ[0, n, m + 1] && NeQ[p, -1]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rule 3798

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + Pi*(k_.) + (f_.)*(x_)], x_Symbol] :> Simp[I*((c + d*x)^(m + 1)/(d*(
m + 1))), x] - Dist[2*I, Int[(c + d*x)^m*E^(2*I*k*Pi)*(E^(2*I*(e + f*x))/(1 + E^(2*I*k*Pi)*E^(2*I*(e + f*x))))
, x], x] /; FreeQ[{c, d, e, f}, x] && IntegerQ[4*k] && IGtQ[m, 0]

Rule 3801

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(c + d*x)^m*((b*Tan[e
 + f*x])^(n - 1)/(f*(n - 1))), x] + (-Dist[b*d*(m/(f*(n - 1))), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 4493

Int[Cos[(a_.) + (b_.)*(x_)]^(n_.)*Cot[(a_.) + (b_.)*(x_)]^(p_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> -Int[
(c + d*x)^m*Cos[a + b*x]^n*Cot[a + b*x]^(p - 2), x] + Int[(c + d*x)^m*Cos[a + b*x]^(n - 2)*Cot[a + b*x]^p, x]
/; FreeQ[{a, b, c, d, m}, x] && IGtQ[n, 0] && IGtQ[p, 0]

Rubi steps \begin{align*} \text {integral}& = -\int x \cos ^2(x) \cot (x) \, dx+\int x \cot ^3(x) \, dx \\ & = -\frac {1}{2} x \cot ^2(x)+\frac {1}{2} \int \cot ^2(x) \, dx-2 \int x \cot (x) \, dx+\int x \cos (x) \sin (x) \, dx \\ & = -\frac {\cot (x)}{2}-\frac {1}{2} x \cot ^2(x)+\frac {1}{2} x \sin ^2(x)-2 \left (-\frac {i x^2}{2}-2 i \int \frac {e^{2 i x} x}{1-e^{2 i x}} \, dx\right )-\frac {\int 1 \, dx}{2}-\frac {1}{2} \int \sin ^2(x) \, dx \\ & = -\frac {x}{2}-\frac {\cot (x)}{2}-\frac {1}{2} x \cot ^2(x)+\frac {1}{4} \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x)-\frac {\int 1 \, dx}{4}-2 \left (-\frac {i x^2}{2}+x \log \left (1-e^{2 i x}\right )-\int \log \left (1-e^{2 i x}\right ) \, dx\right ) \\ & = -\frac {3 x}{4}-\frac {\cot (x)}{2}-\frac {1}{2} x \cot ^2(x)+\frac {1}{4} \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x)-2 \left (-\frac {i x^2}{2}+x \log \left (1-e^{2 i x}\right )+\frac {1}{2} i \text {Subst}\left (\int \frac {\log (1-x)}{x} \, dx,x,e^{2 i x}\right )\right ) \\ & = -\frac {3 x}{4}-\frac {\cot (x)}{2}-\frac {1}{2} x \cot ^2(x)-2 \left (-\frac {i x^2}{2}+x \log \left (1-e^{2 i x}\right )-\frac {1}{2} i \operatorname {PolyLog}\left (2,e^{2 i x}\right )\right )+\frac {1}{4} \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.19 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.85 \[ \int x \cos ^2(x) \cot ^3(x) \, dx=\frac {1}{8} \left (8 i x^2-2 x \cos (2 x)-4 \cot (x)-4 x \csc ^2(x)-16 x \log \left (1-e^{2 i x}\right )+8 i \operatorname {PolyLog}\left (2,e^{2 i x}\right )+\sin (2 x)\right ) \]

[In]

Integrate[x*Cos[x]^2*Cot[x]^3,x]

[Out]

((8*I)*x^2 - 2*x*Cos[2*x] - 4*Cot[x] - 4*x*Csc[x]^2 - 16*x*Log[1 - E^((2*I)*x)] + (8*I)*PolyLog[2, E^((2*I)*x)
] + Sin[2*x])/8

Maple [A] (verified)

Time = 4.21 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.49

method result size
risch \(i x^{2}-\frac {\left (2 x +i\right ) {\mathrm e}^{2 i x}}{16}-\frac {\left (-i+2 x \right ) {\mathrm e}^{-2 i x}}{16}+\frac {2 \,{\mathrm e}^{2 i x} x -i {\mathrm e}^{2 i x}+i}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}-2 x \ln \left ({\mathrm e}^{i x}+1\right )-2 x \ln \left (1-{\mathrm e}^{i x}\right )+2 i \operatorname {polylog}\left (2, -{\mathrm e}^{i x}\right )+2 i \operatorname {polylog}\left (2, {\mathrm e}^{i x}\right )\) \(109\)

[In]

int(x*cos(x)^2*cot(x)^3,x,method=_RETURNVERBOSE)

[Out]

I*x^2-1/16*(2*x+I)*exp(2*I*x)-1/16*(-I+2*x)*exp(-2*I*x)+(2*exp(2*I*x)*x-I*exp(2*I*x)+I)/(exp(2*I*x)-1)^2-2*x*l
n(exp(I*x)+1)-2*x*ln(1-exp(I*x))+2*I*polylog(2,-exp(I*x))+2*I*polylog(2,exp(I*x))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 203 vs. \(2 (52) = 104\).

Time = 0.27 (sec) , antiderivative size = 203, normalized size of antiderivative = 2.78 \[ \int x \cos ^2(x) \cot ^3(x) \, dx=-\frac {2 \, x \cos \left (x\right )^{4} - 3 \, x \cos \left (x\right )^{2} + 4 \, {\left (-i \, \cos \left (x\right )^{2} + i\right )} {\rm Li}_2\left (\cos \left (x\right ) + i \, \sin \left (x\right )\right ) + 4 \, {\left (i \, \cos \left (x\right )^{2} - i\right )} {\rm Li}_2\left (\cos \left (x\right ) - i \, \sin \left (x\right )\right ) + 4 \, {\left (i \, \cos \left (x\right )^{2} - i\right )} {\rm Li}_2\left (-\cos \left (x\right ) + i \, \sin \left (x\right )\right ) + 4 \, {\left (-i \, \cos \left (x\right )^{2} + i\right )} {\rm Li}_2\left (-\cos \left (x\right ) - i \, \sin \left (x\right )\right ) + 4 \, {\left (x \cos \left (x\right )^{2} - x\right )} \log \left (\cos \left (x\right ) + i \, \sin \left (x\right ) + 1\right ) + 4 \, {\left (x \cos \left (x\right )^{2} - x\right )} \log \left (\cos \left (x\right ) - i \, \sin \left (x\right ) + 1\right ) + 4 \, {\left (x \cos \left (x\right )^{2} - x\right )} \log \left (-\cos \left (x\right ) + i \, \sin \left (x\right ) + 1\right ) + 4 \, {\left (x \cos \left (x\right )^{2} - x\right )} \log \left (-\cos \left (x\right ) - i \, \sin \left (x\right ) + 1\right ) - {\left (\cos \left (x\right )^{3} + \cos \left (x\right )\right )} \sin \left (x\right ) - x}{4 \, {\left (\cos \left (x\right )^{2} - 1\right )}} \]

[In]

integrate(x*cos(x)^2*cot(x)^3,x, algorithm="fricas")

[Out]

-1/4*(2*x*cos(x)^4 - 3*x*cos(x)^2 + 4*(-I*cos(x)^2 + I)*dilog(cos(x) + I*sin(x)) + 4*(I*cos(x)^2 - I)*dilog(co
s(x) - I*sin(x)) + 4*(I*cos(x)^2 - I)*dilog(-cos(x) + I*sin(x)) + 4*(-I*cos(x)^2 + I)*dilog(-cos(x) - I*sin(x)
) + 4*(x*cos(x)^2 - x)*log(cos(x) + I*sin(x) + 1) + 4*(x*cos(x)^2 - x)*log(cos(x) - I*sin(x) + 1) + 4*(x*cos(x
)^2 - x)*log(-cos(x) + I*sin(x) + 1) + 4*(x*cos(x)^2 - x)*log(-cos(x) - I*sin(x) + 1) - (cos(x)^3 + cos(x))*si
n(x) - x)/(cos(x)^2 - 1)

Sympy [F]

\[ \int x \cos ^2(x) \cot ^3(x) \, dx=\int x \cos ^{2}{\left (x \right )} \cot ^{3}{\left (x \right )}\, dx \]

[In]

integrate(x*cos(x)**2*cot(x)**3,x)

[Out]

Integral(x*cos(x)**2*cot(x)**3, x)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1718 vs. \(2 (52) = 104\).

Time = 0.36 (sec) , antiderivative size = 1718, normalized size of antiderivative = 23.53 \[ \int x \cos ^2(x) \cot ^3(x) \, dx=\text {Too large to display} \]

[In]

integrate(x*cos(x)^2*cot(x)^3,x, algorithm="maxima")

[Out]

-1/16*((2*x + I)*cos(6*x)^2 + 4*(8*I*x^2 + 2*x + I)*cos(4*x)^2 + 4*(8*I*x^2 - 7*x + 4*I)*cos(2*x)^2 - (2*x + I
)*sin(6*x)^2 + 4*(-8*I*x^2 - 2*x - I)*sin(4*x)^2 + 4*(-8*I*x^2 + 7*x - 4*I)*sin(2*x)^2 + 32*(-2*I*x*cos(4*x)^2
 - 2*I*x*cos(2*x)^2 + 2*I*x*sin(4*x)^2 + 2*I*x*sin(2*x)^2 + (I*x*cos(4*x) - 2*I*x*cos(2*x) - x*sin(4*x) + 2*x*
sin(2*x) + I*x)*cos(6*x) + (5*I*x*cos(2*x) - 5*x*sin(2*x) - 2*I*x)*cos(4*x) + I*x*cos(2*x) - (x*cos(4*x) - 2*x
*cos(2*x) + I*x*sin(4*x) - 2*I*x*sin(2*x) + x)*sin(6*x) + (4*x*cos(4*x) - 5*x*cos(2*x) - 5*I*x*sin(2*x) + 2*x)
*sin(4*x) + (4*x*cos(2*x) - x)*sin(2*x))*arctan2(sin(x), cos(x) + 1) + 32*(2*I*x*cos(4*x)^2 + 2*I*x*cos(2*x)^2
 - 2*I*x*sin(4*x)^2 - 2*I*x*sin(2*x)^2 + (-I*x*cos(4*x) + 2*I*x*cos(2*x) + x*sin(4*x) - 2*x*sin(2*x) - I*x)*co
s(6*x) + (-5*I*x*cos(2*x) + 5*x*sin(2*x) + 2*I*x)*cos(4*x) - I*x*cos(2*x) + (x*cos(4*x) - 2*x*cos(2*x) + I*x*s
in(4*x) - 2*I*x*sin(2*x) + x)*sin(6*x) - (4*x*cos(4*x) - 5*x*cos(2*x) - 5*I*x*sin(2*x) + 2*x)*sin(4*x) - (4*x*
cos(2*x) - x)*sin(2*x))*arctan2(sin(x), -cos(x) + 1) - (16*I*x^2 - 4*(-4*I*x^2 - 2*x - I)*cos(4*x) + (-32*I*x^
2 + 26*x - 17*I)*cos(2*x) - 4*(4*x^2 - 2*I*x + 1)*sin(4*x) + (32*x^2 + 26*I*x + 17)*sin(2*x) + 4*x + 14*I)*cos
(6*x) - (-32*I*x^2 - 2*(-40*I*x^2 + 26*x - 17*I)*cos(2*x) - 2*(40*x^2 + 26*I*x + 17)*sin(2*x) - 10*x - 27*I)*c
os(4*x) + 4*(-4*I*x^2 - 2*x - 3*I)*cos(2*x) + 32*((-I*cos(4*x) + 2*I*cos(2*x) + sin(4*x) - 2*sin(2*x) - I)*cos
(6*x) + (-5*I*cos(2*x) + 5*sin(2*x) + 2*I)*cos(4*x) + 2*I*cos(4*x)^2 + 2*I*cos(2*x)^2 + (cos(4*x) - 2*cos(2*x)
 + I*sin(4*x) - 2*I*sin(2*x) + 1)*sin(6*x) - (4*cos(4*x) - 5*cos(2*x) - 5*I*sin(2*x) + 2)*sin(4*x) - 2*I*sin(4
*x)^2 - (4*cos(2*x) - 1)*sin(2*x) - 2*I*sin(2*x)^2 - I*cos(2*x))*dilog(-e^(I*x)) + 32*((-I*cos(4*x) + 2*I*cos(
2*x) + sin(4*x) - 2*sin(2*x) - I)*cos(6*x) + (-5*I*cos(2*x) + 5*sin(2*x) + 2*I)*cos(4*x) + 2*I*cos(4*x)^2 + 2*
I*cos(2*x)^2 + (cos(4*x) - 2*cos(2*x) + I*sin(4*x) - 2*I*sin(2*x) + 1)*sin(6*x) - (4*cos(4*x) - 5*cos(2*x) - 5
*I*sin(2*x) + 2)*sin(4*x) - 2*I*sin(4*x)^2 - (4*cos(2*x) - 1)*sin(2*x) - 2*I*sin(2*x)^2 - I*cos(2*x))*dilog(e^
(I*x)) - 16*(2*x*cos(4*x)^2 + 2*x*cos(2*x)^2 - 2*x*sin(4*x)^2 - 2*x*sin(2*x)^2 - (x*cos(4*x) - 2*x*cos(2*x) +
I*x*sin(4*x) - 2*I*x*sin(2*x) + x)*cos(6*x) - (5*x*cos(2*x) + 5*I*x*sin(2*x) - 2*x)*cos(4*x) - x*cos(2*x) - (I
*x*cos(4*x) - 2*I*x*cos(2*x) - x*sin(4*x) + 2*x*sin(2*x) + I*x)*sin(6*x) - (-4*I*x*cos(4*x) + 5*I*x*cos(2*x) -
 5*x*sin(2*x) - 2*I*x)*sin(4*x) - (-4*I*x*cos(2*x) + I*x)*sin(2*x))*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) -
16*(2*x*cos(4*x)^2 + 2*x*cos(2*x)^2 - 2*x*sin(4*x)^2 - 2*x*sin(2*x)^2 - (x*cos(4*x) - 2*x*cos(2*x) + I*x*sin(4
*x) - 2*I*x*sin(2*x) + x)*cos(6*x) - (5*x*cos(2*x) + 5*I*x*sin(2*x) - 2*x)*cos(4*x) - x*cos(2*x) - (I*x*cos(4*
x) - 2*I*x*cos(2*x) - x*sin(4*x) + 2*x*sin(2*x) + I*x)*sin(6*x) - (-4*I*x*cos(4*x) + 5*I*x*cos(2*x) - 5*x*sin(
2*x) - 2*I*x)*sin(4*x) - (-4*I*x*cos(2*x) + I*x)*sin(2*x))*log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) + (16*x^2 +
 2*(2*I*x - 1)*cos(6*x) + 4*(4*x^2 - 2*I*x + 1)*cos(4*x) - (32*x^2 + 26*I*x + 17)*cos(2*x) + 4*(4*I*x^2 + 2*x
+ I)*sin(4*x) - (32*I*x^2 - 26*x + 17*I)*sin(2*x) - 4*I*x + 14)*sin(6*x) - (32*x^2 + 8*(8*x^2 - 2*I*x + 1)*cos
(4*x) - 2*(40*x^2 + 26*I*x + 17)*cos(2*x) - 2*(40*I*x^2 - 26*x + 17*I)*sin(2*x) - 10*I*x + 27)*sin(4*x) + 4*(4
*x^2 - 2*(8*x^2 + 7*I*x + 4)*cos(2*x) - 2*I*x + 3)*sin(2*x) + 2*x - I)/((cos(4*x) - 2*cos(2*x) + I*sin(4*x) -
2*I*sin(2*x) + 1)*cos(6*x) + (5*cos(2*x) + 5*I*sin(2*x) - 2)*cos(4*x) - 2*cos(4*x)^2 - 2*cos(2*x)^2 + (I*cos(4
*x) - 2*I*cos(2*x) - sin(4*x) + 2*sin(2*x) + I)*sin(6*x) + (-4*I*cos(4*x) + 5*I*cos(2*x) - 5*sin(2*x) - 2*I)*s
in(4*x) + 2*sin(4*x)^2 + (-4*I*cos(2*x) + I)*sin(2*x) + 2*sin(2*x)^2 + cos(2*x))

Giac [F]

\[ \int x \cos ^2(x) \cot ^3(x) \, dx=\int { x \cos \left (x\right )^{2} \cot \left (x\right )^{3} \,d x } \]

[In]

integrate(x*cos(x)^2*cot(x)^3,x, algorithm="giac")

[Out]

integrate(x*cos(x)^2*cot(x)^3, x)

Mupad [F(-1)]

Timed out. \[ \int x \cos ^2(x) \cot ^3(x) \, dx=\int x\,{\cos \left (x\right )}^2\,{\mathrm {cot}\left (x\right )}^3 \,d x \]

[In]

int(x*cos(x)^2*cot(x)^3,x)

[Out]

int(x*cos(x)^2*cot(x)^3, x)